#include <iostream>

using namespace std;

//递增运算符重载作用: 通过重载递增运算符，实现自己的整型数据
class Integer {
private:
    int num;
public:
    Integer() {

    }

    Integer(int num) : num(num) {

    }

    int getNum() const {
        return num;
    }

    //重载前置++运算符
    Integer &operator++() {
        num++;
        return *this;
    }

    //重载后置++运算符
    //int 代表占位参数，可以区分前置和后置递增
    Integer operator++(int) {
        //先记录结果
        Integer temp=*this;
        //后递增
        num++;
        //返回记录结果
        return temp;
    }
};

//重载左移运算符
ostream &operator<<(ostream &cout, Integer integer) {
    cout << integer.getNum();
    return cout;
}

void test1() {
    Integer integer(10);
    cout << integer << endl;
    cout << ++integer << endl;
    cout << integer << endl;
}

void test2() {
    Integer integer(10);
    cout << integer << endl;
    cout << integer++ << endl;
    cout << integer << endl;
}

int main() {
    test1();
    cout << "=========" << endl;
    test2();
    return 0;
}
